Common Commands

Caution

This section is under development. Thank you for your patience.

I’ll tie in examples relevant to macOS, particularly focusing on files and folders you might find in the /bin directory, which is like a toolshed for software tools on your computer.

Manipulate Files and Folders

  • mkdir (Make Directory): Deciding you need a new shelf for your comic book collection, you build one. mkdir builds a new folder wherever you tell it to, like making a new folder for projects in /bin, although you typically wouldn’t do that there.

  • cp (Copy): Photocopying your friend’s recipe so you both can have a copy, cp duplicates files or folders. For instance, copying a tool from /bin to your desktop, but usually, you leave /bin tools where they are.

  • mv (Move): Taking a book from your desk and putting it on the shelf, mv moves files or folders from one place to another. It’s like moving a misplaced tool back into /bin.

  • rm (Remove): Throwing away an old, tattered magazine, rm deletes files or folders. Be cautious, as this is like shredding documents—no easy way to get them back.

  • ln (Link): Creating a shortcut on your desktop to a frequently used program, ln creates links to files, making them accessible from multiple places without duplicating them.

Manipulate Text

  • cat (Concatenate): Laying out pages on the floor to see them all at once, cat displays the content of files straight to your screen, useful for checking what’s in a text file quickly.

  • sort: Organizing a stack of papers alphabetically, sort arranges the lines in a text file into order.

  • uniq: After accidentally printing duplicates of a document, you remove the extra copies. uniq helps by removing duplicate lines from a file, making sure every line is unique.

  • cut: If you only want the dates from a list of events, you might physically cut them out of the paper. cut extracts specific parts of lines in a file, like cutting out columns of text.

  • paste: Taking snippets of text from different documents and sticking them together into one, paste combines lines from multiple files side by side.

  • join: If you have two lists with common information, you might merge them based on what matches. join merges lines from two files based on a common field.

  • comm (Compare): Laying two printed lists side by side to see what items appear on both, only on one, or the other, comm compares two sorted files line by line.

  • diff (Difference): Highlighting what changes have been made between your draft and the final copy of a letter, diff shows the differences between two files.

These analogies help demystify what can feel like complex commands, tying them back to everyday actions and decisions.

See a typo, error, or something missing?

Please open an issue on GitHub.